package com.example.sequence.sort;

import java.util.Arrays;

public class   Select {
    public static void main(String[] args) {
        int[] arr = {12, 77, 54, 13, 62, 18, 5, 7};
        for (int i = 0; i < arr.length; i++) {
            int idx = i;
            for (int j = i + 1; j < arr.length; j++) {
                if (arr[idx] > arr[j]) {
                    idx = j;
                }
            }
            if (idx != i) {
                int temp = arr[i];
                arr[i] = arr[idx];
                arr[idx] = temp;
            }

        }
        System.out.println(Arrays.toString(arr));
    }
}
